
<%@ page import="sige.Pagamento" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'pagamento.label', default: 'Pagamento')}" />
		<title><g:message code="default.show.label" args="[entityName]" /></title>
	</head>
	<body>
            <center><h1><g:message code="default.show.label" args="[entityName]" /></h1></center>
            <ul class="breadcrumb">
                <li>
                  <a href="${createLink(uri: '/')}">
                    <i class="icon-home"></i>
                    <g:message code="default.home.label"/>
                  </a>
                </li>
                <li>
                  <g:link class="list" action="list">
                    <i class="icon-list"></i>
                    <g:message code="default.list.label" args="[entityName]" />
                  </g:link>
                </li>
            </ul>
            <div id="show-pagamento" class="span8" role="main">

                <g:if test="${flash.message}">
                <div class="alert alert-info">${flash.message}</div>
                </g:if>
                <ol class="well">

                    <g:if test="${pagamentoInstance?.movimentacao}">
                    <li class="fieldcontain">
                        <span id="movimentacao-label" ><g:message code="pagamento.movimentacao.label" default="Movimentacao" /></span>
                        <span aria-labelledby="movimentacao-label">
                          <g:link controller="${pagamentoInstance?.movimentacao?.class.simpleName}" action="show" id="${pagamentoInstance?.movimentacao?.id}">
                              ${pagamentoInstance?.movimentacao?.ordem?.encodeAsHTML()}
                          </g:link>
                        </span>
                    </li>
                    </g:if>
                  
                    <g:if test="${pagamentoInstance?.dataDeVencimento}">
                    <li class="fieldcontain">
                        <span id="dataDeVencimento-label" class="property-label"><g:message code="pagamento.dataDeVencimento.label" default="Data De Vencimento" /></span>
                        <span class="property-value" aria-labelledby="dataDeVencimento-label"><g:formatDate date="${pagamentoInstance?.dataDeVencimento}" /></span>

                    </li>
                    </g:if>

                    <g:if test="${pagamentoInstance?.valor}">
                    <li class="fieldcontain">
                            <span id="valor-label" class="property-label"><g:message code="pagamento.valor.label" default="Valor" /></span>
                            <span class="property-value" aria-labelledby="valor-label"><g:fieldValue bean="${pagamentoInstance}" field="valor"/></span>
                    </li>
                    </g:if>

                    <g:if test="${pagamentoInstance?.pago}">
                        <g:if test="${pagamentoInstance?.multa}">
                        <li class="fieldcontain">
                                <span id="multa-label" class="property-label"><g:message code="pagamento.multa.label" default="Multa" /></span>
                                <span class="property-value" aria-labelledby="multa-label"><g:fieldValue bean="${pagamentoInstance}" field="multa"/></span>

                        </li>
                        </g:if>

                        <g:if test="${pagamentoInstance?.desconto}">
                        <li class="fieldcontain">
                                <span id="desconto-label" class="property-label"><g:message code="pagamento.desconto.label" default="Desconto" /></span>
                                <span class="property-value" aria-labelledby="desconto-label"><g:fieldValue bean="${pagamentoInstance}" field="desconto"/></span>

                        </li>
                        </g:if>

                        <li class="fieldcontain">
                                <span id="total-label" class="property-label"><g:message code="pagamento.total.label" default="Total" /></span>
                                <span class="property-value" aria-labelledby="total-label"><g:fieldValue bean="${pagamentoInstance}" field="total"/></span>

                        </li>
                      
                        <g:if test="${pagamentoInstance?.dataDePagamento}">
                        <li class="fieldcontain">
                            <span id="dataDePagamento-label" class="property-label"><g:message code="pagamento.dataDePagamento.label" default="Data De Pagamento" /></span>
                            <span class="property-value" aria-labelledby="dataDePagamento-label"><g:formatDate date="${pagamentoInstance?.dataDePagamento}" /></span>

                        </li>
                        </g:if>
                    </g:if>

                    <g:if test="${pagamentoInstance?.caixaDiario}">
                    <li class="fieldcontain">
                        <span id="caixaDiario-label" class="property-label"><g:message code="pagamento.caixaDiario.label" default="Caixa Diario" /></span>
                        <span class="property-value" aria-labelledby="caixaDiario-label">
                            <g:link controller="caixaDiario" action="show" id="${pagamentoInstance?.caixaDiario?.id}">
                                <g:formatDate date="${pagamentoInstance?.caixaDiario?.dataDeAbertura}" />
                            </g:link>
                        </span>

                    </li>
                    </g:if>
                    
                    <g:if test="${pagamentoInstance?.usuario}">
                    <li class="fieldcontain">
                        <span id="usuario-label" class="property-label"><g:message code="pagamento.usuario.label" default="Usuario" /></span>
                        <span class="property-value" aria-labelledby="usuario-label"><g:link controller="usuario" action="show" id="${pagamentoInstance?.usuario?.id}">${pagamentoInstance?.usuario?.encodeAsHTML()}</g:link></span>

                    </li>
                    </g:if>

                </ol>
                <g:form>
                    <fieldset class="form-actions">
                        <g:if test="${!pagamentoInstance?.pago}">
                            <a data-toggle="modal" href="#myModal" class="btn btn-info">
                                <g:message code="pagamento.pagar.label" default="Pagar" />
                            </a>
                        </g:if>
                        <g:hiddenField name="id" value="${pagamentoInstance?.id}" />
                        <g:hiddenField name="usuario.id" value="${session?.usuario?.id}" />
                        <g:link class="btn btn-warning" action="edit" id="${pagamentoInstance?.id}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
                        <g:actionSubmit class="btn btn-danger" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
                        
                        <!-- MODAL -->
                        <div class="modal hide in" id="myModal">
                            <div class="modal-header">
                                <a class="close" data-dismiss="modal">×</a>
                                <h3><g:message code="default.button.delete.atention.message" default="Consolidação de Pagamento" /></h3>
                            </div>
                            <div class="modal-body">
                                <div class="form-horizontal">
                                    <div class="control-group" >
                                       <label  class="control-label" for="dataDePagamento">
                                          <g:message code="pagamento.dataDePagamento.label" default="Data De Pagamento" />
                                          <span class="required-indicator">*</span>
                                       </label> 
                                       <div class="controls"> 
                                          <g:myDatePicker name="dataDePagamento" precision="day"  value="${pagamentoInstance?.dataDePagamento}"  />
                                       </div> 
                                    </div>
                                    <div class="control-group" >
                                         <label  class="control-label" for="valor">
                                             <g:message code="pagamento.valor.label" default="Valor" />
                                             <span class="required-indicator">*</span>
                                         </label>
                                         <div class="controls">
                                            <g:field id="valor" readonly="readonly" type="text" name="usuario.valor"
                                                value="${pagamentoInstance?.valor}" />
                                         </div>
                                     </div>
                                    <div class="control-group" >
                                        <label  class="control-label" for="multa">
                                            <g:message code="pagamento.multa.label" default="Multa" />
                                            <span class="required-indicator">*</span>
                                        </label> 
                                        <div class="controls"> 
                                            <g:textField name="multa" value="${fieldValue(bean: pagamentoInstance, field: 'multa')}" required=""/>
                                        </div>
                                    </div>
                                    <div class="control-group" >
                                        <label  class="control-label" for="desconto">
                                            <g:message code="pagamento.desconto.label" default="Desconto" />
                                            <span class="required-indicator">*</span>
                                        </label> 
                                        <div class="controls"> 
                                            <g:textField name="desconto" value="${fieldValue(bean: pagamentoInstance, field: 'desconto')}" required=""/>
                                        </div> 
                                     </div>
                                     <div class="control-group" >
                                         <label  class="control-label" for="usuario">
                                             <g:message code="pagamento.usuario.label" default="Usuario" />
                                             <span class="required-indicator">*</span>
                                         </label>
                                         <div class="controls">
                                            <g:field readonly="readonly" type="text" name="usuario.login"
                                                value="${session?.usuario?.login?.encodeAsHTML()}" />
                                         </div>
                                     </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <g:actionSubmit class="btn btn-info" action="pagar" value="${message(code: 'pagamento.pagar.label', default: 'Pagar')}" />
                            </div>
                            <g:hiddenField name="dataDeVencimento" value="${pagamentoInstance?.dataDeVencimento}" />
                        </div>
                    </fieldset>
                </g:form>
            </div>
	</body>
</html>
